<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		
		<!--<meta name="viewport" content="user-scalable=no,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0" />-->
		<title>viewport适配问题</title>
		<script>
		(function(){
			var w = window.screen.width;
			var targetW = 320; 
			/*当前尺寸/目标尺寸*/
			var scale = w/targetW;
			var meta = document.createElement("meta");
			meta.name = 'viewport';
			meta.content = 'user-scalable=no,initial-scale='+ scale +',minimum-scale='+ scale +',maximum-scale='+ scale +'';
			document.head.appendChild(meta);
		})();
	</script>
		<style>
			body{
				margin: 0;
			}
			div{
				width: 25%;
				height: 100px;
				float: left;
			}
			.box1{
				background: pink;
			}
			.box2{
				background:purple;
			}
			.box3{
				background: orangered;
			}
			.box4{
				background: green;
			}
			/*
				百分比适配宽度可以用，但是高度不能用百分比，因为每款移动端设备的高度是不一样的，百分比不能很好的展示
			*/
		</style>
	</head>
	<body>
		<div class="box1"></div>
		<div class="box2"></div>
		<div class="box3"></div>
		<div class="box4"></div>
	</body>
	
</html>
